<template>

    <div id="myChart" :style="{width: '1300px', height: '600px'}"></div>

</template>

<script>
  export default {
    name: 'hello',
    data () {
      return {
        tname:null,
        count:null
      }
    },
    mounted(){
      this.selectData();
      this.drawLine();


    },
    methods: {
      selectData(){
      },
      drawLine(){
        // 基于准备好的dom，初始化echarts实例
        let myChart = this.$echarts.init(document.getElementById('myChart'))
        // 绘制图表
        this.$axios.get("http://127.0.0.1:8999/teacher/selectData").then(res=>{
          if(res.data.code==200){
            myChart.setOption({
              title: { text: '课程柱形图' },
              tooltip: {},
              xAxis: {
                data: res.data.data
              },
              yAxis: {},
              series: [{
                name: '课程数',
                type: 'bar',
                data: res.data.list
              }]
            });
          }
        })

      }
    }
  }
</script>
